/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Account;

import DAO_BUS.MyTable;
import DataObject.TableObject;
import java.util.Vector;

/**
 *
 * @author suzunghia
 */
public class AccountManager {

    Vector<Account> list = new Vector<>();

    public boolean CheckAccount(String user, String pass) {
        for (int i = 0; i < list.size(); i++) {
            if (((Account) list.get(i)).isAccount(user, pass)) {
                return true;
            }
        }
        return false;
    }

    public  boolean CreateList(MyTable myTable, String user, String pass) {
        list.removeAllElements();
        String[] str;
        Vector<Class> cls = new Vector<>();
        Vector<TableObject> data = new Vector<>();
        str = myTable.getTableObjectData(data, cls);
        for (int i = 0; i < data.size(); i++) {
            list.add(new Account((String) data.get(i).getAttributeAt(0), (String) data.get(i).getAttributeAt(1)));
        }
        return CheckAccount(user, pass);
    }
}
